package MatchesDemo;

public class MatchesDemo {
    /**
     * 用于验证邮箱等
     */
    public static void main(String[] args) {
        String email="xiaowuwu@qq.com.cn";
        String regex="[a-zA-z0-9_]+@[a-zA-Z0-9]+(\\.[a-zA-Z]+)+";
        boolean math=email.matches(regex);
        System.out.println(math);
        if(math){
            System.out.println("符合邮箱类型");
        }else{
            System.out.println("不符合邮箱规范");
        }

    }
}
